package com.qipay.scalar.type;

public enum ApiResultCodeEnum {
    OK((short) 0, "0"),
    ERROR_ORDER_STATUS((short) 1001, "ERROR_ORDER_STATUS");

    private Short type;
    private String info;

    ApiResultCodeEnum(Short type, String info) {
        this.type = type;
        this.info = info;
    }

    public Short getType() {
        return type;
    }

    public void setType(Short type) {
        this.type = type;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    public static String getInfo(Short type) {

        String info = "";

        for (ApiResultCodeEnum p : ApiResultCodeEnum.values()) {
            if (p.getType().equals(type)) {
                info = p.getInfo();
                break;
            }
        }

        return info;
    }

    public static ApiResultCodeEnum getByType(Byte type) {
        for (ApiResultCodeEnum p : ApiResultCodeEnum.values()) {
            if (p.getType().equals(type)) {
                return p;
            }
        }
        return null;
    }
}
